home *** CD-ROM | disk | FTP | other *** search
Wrap
RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) NNNNaaaammmmeeee RWvistream - Rogue Wave library class SSSSyyyynnnnooooppppssssiiiissss #include <rw/vstream.h> DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn Class RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm is an abstract base class. It provides an interface for format-independent retrieval of fundamental types and arrays of fundamental types. Its counterpart, RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm, provides a complementary interface for the storage of the fundamental types. Because the interface of RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm and RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm is independent of formatting, the user of these classes need not be concerned with how variables will actually be stored or restored. That will be up to the derived class to decide. It might be done using an operating-system independent ASCII format (classes RRRRWWWWppppiiiissssttttrrrreeeeaaaammmm and RRRRWWWWppppoooossssttttrrrreeeeaaaammmm), a binary format (classes RRRRWWWWbbbbiiiissssttttrrrreeeeaaaammmm and RRRRWWWWbbbboooossssttttrrrreeeeaaaammmm), or the user could define his or her own format (eeee....gggg...., an interface to a network). Note that because it is an aaaabbbbssssttttrrrraaaacccctttt base class, there is no way to actually enforce these goals -- the description here is merely the model of how a class derived from RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm and RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm should act. See class RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm for additional explanations and examples of format-independent stream storage. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee None EEEExxxxaaaammmmpppplllleeee #include <rw/vstream.h> void restoreStuff( RWvistream& str) { int i; double d; char string[80]; str >> i; // Restore an int str >> d; // Restore a double // Restore a character string, up to 80 characters long: str.getString(string, sizeof(string)); if(str.fail()) cerr << "Oh, oh, bad news.0; PPPPuuuubbbblllliiiicccc DDDDeeeessssttttrrrruuuuccccttttoooorrrr } virtual ~~~~RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm(); PPPPaaaaggggeeee 1111 RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) This virtual destructor allows specializing classes to deallocate any resources that they may have allocated. PPPPuuuubbbblllliiiicccc OOOOppppeeeerrrraaaattttoooorrrrssss virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(char& c) = 0; Get the next cccchhhhaaaarrrr from the input stream and store it in cccc. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(wchar_t& wc) = 0; Get the next wwwwcccchhhhaaaarrrr____tttt from the input stream and store it in wwwwcccc. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(double& d) = 0; Get the next ddddoooouuuubbbblllleeee from the input stream and store it in dddd. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(float& f) = 0; Get the next ffffllllooooaaaatttt from the input stream and store it in ffff. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(int& i) = 0; Get the next iiiinnnntttt from the input stream and store it in iiii. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(long& l) = 0; Get the next lllloooonnnngggg from the input stream and store it in llll. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(short& s) = 0; Get the next sssshhhhoooorrrrtttt from the input stream and store it in ssss. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned char& c) = 0; PPPPaaaaggggeeee 2222 RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) Get the next uuuunnnnssssiiiiggggnnnneeeedddd cccchhhhaaaarrrr from the input stream and store it in cccc. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned short& s) = 0; Get the next uuuunnnnssssiiiiggggnnnneeeedddd sssshhhhoooorrrrtttt from the input stream and store it in ssss. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned int& i) = 0; Get the next uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttt from the input stream and store it in iiii. virtual RWvistream& ooooppppeeeerrrraaaattttoooorrrr>>>>>>>>(unsigned long& l) = 0; Get the next uuuunnnnssssiiiiggggnnnneeeedddd lllloooonnnngggg from the input stream and store it in llll. ooooppppeeeerrrraaaattttoooorrrr vvvvooooiiiidddd****(); Inherited from RRRRWWWWvvvviiiioooossss. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss virtual int ggggeeeetttt() = 0; Get and return the next byte from the input stream, returning its value. Returns EEEEOOOOFFFF if end of file is encountered. virtual RWvistream& ggggeeeetttt(char& c) = 0; Get the next cccchhhhaaaarrrr from the input stream, returning its value in cccc. virtual RWvistream& ggggeeeetttt(wchar_t& wc) = 0; Get the next wwwwcccchhhhaaaarrrr____tttt from the input stream, returning its value in wwwwcccc. virtual RWvistream& ggggeeeetttt(unsigned char& c) = 0; Get the next uuuunnnnssssiiiiggggnnnneeeedddd cccchhhhaaaarrrr from the input stream, returning its value in cccc. PPPPaaaaggggeeee 3333 RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) virtual RWvistream& ggggeeeetttt(char* v, size_t N) = 0; Get a vector of cccchhhhaaaarrrrs and store them in the array beginning at vvvv. If the restore operation stops prematurely because there are no more data available on the stream, because an exception is thrown, or for some other reason, ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. Note that ggggeeeetttt retrieves raw characters and does not perform any conversions on speical characters such as "0. virtual RWvistream& ggggeeeetttt(wchar_t* v, size_t N) = 0; Get a vector of wide characterss and store them in the array beginning at vvvv. If the restore operation stops prematurely because there are no more data available on the stream, because an exception is thrown, or for some other reason, ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. Note that ggggeeeetttt retrieves raw characters and does not perform any conversions on speical characters such as "0. virtual RWvistream& ggggeeeetttt(double* v, size_t N) = 0; Get a vector of NNNN ddddoooouuuubbbblllleeees and store them in the array beginning at vvvv. If the restore operation stops prematurely because there are no more data available on the stream, because an exception is thrown, or for some other reason, ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. virtual RWvistream& ggggeeeetttt(float* v, size_t N) = 0; Get a vector of NNNN ffffllllooooaaaatttts and store them in the array beginning at vvvv. If the restore operation stops prematurely because there are no more data available on the stream, because an exception is thrown, or for some other reason, ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. virtual RWvistream& ggggeeeetttt(int* v, size_t N) = 0; Get a vector of NNNN iiiinnnntttts and store them in the array beginning at vvvv. If the restore operation stops prematurely because there are no more data available on the stream, because an exception is thrown, or for some other reason, ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. PPPPaaaaggggeeee 4444 RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) virtual RWvistream& ggggeeeetttt(long* v, size_t N) = 0; Get a vector of NNNN lllloooonnnnggggs and store them in the array beginning at vvvv. If the restore operation stops prematurely because there are no more data available on the stream, because an exception is thrown, or for some other reason,ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. virtual RWvistream& ggggeeeetttt(short* v, size_t N) = 0; Get a vector of NNNN sssshhhhoooorrrrtttts and store them in the array beginning at vvvv. If the restore operation stops prematurely because there are no more data available on the stream, because an exception is thrown, or for some other reason,ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. virtual RWvistream& ggggeeeetttt(unsigned char* v, size_t N) = 0; Get a vector of NNNN uuuunnnnssssiiiiggggnnnneeeedddd cccchhhhaaaarrrrs and store them in the array beginning at vvvv. If the restore operation stops prematurely because there are no more data available on the stream, because an exception is thrown, or for some other reason, ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. Note that this member preserves ASCII numerical codes, not their corresponding character values. If you wish to restore a character string, use the function ggggeeeettttSSSSttttrrrriiiinnnngggg((((cccchhhhaaaarrrr****,,,, ssssiiiizzzzeeee____tttt)))).... virtual RWvistream& ggggeeeetttt(unsigned short* v, size_t N) = 0; Get a vector of NNNN uuuunnnnssssiiiiggggnnnneeeedddd sssshhhhoooorrrrtttts and store them in the array beginning at vvvv. If the restore operation stops prematurely because there are no more data available on the stream, because an exception is thrown, or for some other reason, ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. virtual RWvistream& ggggeeeetttt(unsigned int* v, size_t N) = 0; Get a vector of NNNN uuuunnnnssssiiiiggggnnnneeeedddd iiiinnnntttts and store them in the array beginning at vvvv. If the restore operation stops prematurely because there are no more data available on the stream, because an exception is thrown, or for some other reason, ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. PPPPaaaaggggeeee 5555 RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) RRRRWWWWvvvviiiissssttttrrrreeeeaaaammmm((((3333CCCC++++++++)))) virtual RWvistream& ggggeeeetttt(unsigned long* v, size_t N) = 0; Get a vector of NNNN uuuunnnnssssiiiiggggnnnneeeedddd lllloooonnnnggggs and store them in the array beginning at vvvv. If the restore operation stops prematurely because there are no more data available on the stream, because an exception is thrown, or for some other reason, ggggeeeetttt stores what has already been retrieved from the stream into vvvv, and sets the failbit. virtual RWvistream& ggggeeeettttSSSSttttrrrriiiinnnngggg(char* s, size_t N) = 0; Restores a character string from the input stream that was stored to the output stream with RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm::::::::ppppuuuuttttssssttttrrrriiiinnnngggg and stores it in the array beginning at ssss. The function stops reading at the end of the string or after NNNN----1111 characters, whichever comes first. If NNNN----1111 characters have been read and the NNNNtttthhhh character is not the string terminator, then the failbit of the stream will be set. In either case, the string will be terminated with a null byte. virtual RWvistream& ggggeeeettttSSSSttttrrrriiiinnnngggg(wchar_t* ws, size_t N) = 0; Restores a wide character string from the input stream that was stored to the output stream with RRRRWWWWvvvvoooossssttttrrrreeeeaaaammmm::::::::ppppuuuuttttssssttttrrrriiiinnnngggg and stores it in the array beginning at wwwwssss. The function stops reading at the end of the string or after NNNN----1111 characters, whichever comes first. If NNNN----1111 characters have been read and the NNNNtttthhhh character is not the string terminator, then the failbit of the stream will be set. In either case, the string will be terminated with a null byte. PPPPaaaaggggeeee 6666